package com.mk.springboot.until;

import com.mk.springboot.pojo.User;

public class ResultUtil {
    public static Result success(String msg, User object) {
        Result result = new Result();
        result.setCode(200);
        result.setMsg(msg);
        result.setData(object);
        return result;
    }

    public static Result success(String msg) {
        Result result = new Result();
        result.setCode(200);
        result.setMsg(msg);
        return result;
    }

    public static Result success() {
        Result result = new Result();
        result.setCode(200);
        result.setMsg("成功！");
        return result;
    }

    public static Result warning(String msg) {
        Result result = new Result();
        result.setCode(300);
        result.setMsg(msg);
        return result;
    }

    public static Result error(Integer code, String msg) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }
}
